package none.rg.gantt.test;


import none.rg.gantt.model.*;
import org.junit.*;
import java.util.*;


public class CalculatorTestNonFixed extends Calculator {
    
    
    Chart chart;
    Task taskA, taskB;
    Map<Integer, Node> map;
    
    
    public CalculatorTestNonFixed() {
        chart = new Chart();
        taskA = new Task(chart, "A", 5, false);
        taskB = new Task(chart, "B", 6, false);
        chart.enableRecalc(false);
        chart.addLink(taskA, taskB, Link.Type.FINISH_START);
        init(chart);
        map = getNodes();
    } // CalculatorTestNonFixed
    
    
    @Test
    public void testCreateStructure() throws Exception {
        Assert.assertEquals(4, map.size());
        Assert.assertEquals(0, map.get(0).getIns());
        Assert.assertEquals(1, map.get(1).getIns());
        Assert.assertEquals(1, map.get(2).getIns());
        Assert.assertEquals(1, map.get(3).getIns());
    } // testCreateStructure
    
    
    @Test
    public void testProcess() {
        process();
        Assert.assertEquals(0, taskA.getStart());
        Assert.assertEquals(5, taskB.getStart());
    } // testProcess
    
    
    // for debugging test case inside IDE
    public static void main(String[] args) {
        org.junit.runner.JUnitCore.main(
                new Object(){}.getClass().getEnclosingClass().getName());
    } // main
    
    
} // class CalculatorTestNonFixed
